package com.youmeek.ssm.manage.controller;

import com.youmeek.ssm.manage.vo.EUDataGridResult;
import com.youmeek.ssm.manage.pojo.TbItem;
import com.youmeek.ssm.manage.service.ItemService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by 杨建 on 2017/4/6.
 */

    @Controller
    public class ItemController {

        @Resource
        private ItemService itemService;

        @RequestMapping("/item/{itemId}")
        @ResponseBody
        public TbItem getItemById(@PathVariable Long itemId) {
            TbItem tbItem = itemService.getItemById(itemId);
            return tbItem;
        }
    @RequestMapping("/index")
    public String login(HttpServletRequest request, HttpServletResponse response){
        return "index";
    }
    @RequestMapping("/item/list")
    @ResponseBody
    public EUDataGridResult getItemList(Integer page, Integer rows) {
        EUDataGridResult result = itemService.getItemList(page, rows);
        return result;
    }
}

